package com.wuyou.sso.common.excption;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.wuyou.sso.common.component.CustomizedOAuth2ExceptionSerializer;
import org.springframework.http.HttpStatus;

/**
 * @author lishangbu
 * @date 2018/7/8
 */
@JsonSerialize(using = CustomizedOAuth2ExceptionSerializer.class)
public class UnauthorizedException extends CustomizedAuth2Exception {

    private static final long serialVersionUID = 1L;

    public UnauthorizedException(String msg, Throwable t) {
        super(msg);
    }

    @Override
    public String getOAuth2ErrorCode() {
        return "unauthorized";
    }

    @Override
    public int getHttpErrorCode() {
        return HttpStatus.UNAUTHORIZED.value();
    }
}
